import React, { useEffect } from 'react'
import ReactDOM from 'react-dom/client'
import 'antd/dist/reset.css'
import Layout from './layout'
import zhCN from 'antd/locale/zh_CN'
import { ConfigProvider } from 'antd'
import './assets/base.css'
import defineThemeStore from './stores/theme'
const App: React.FC = () => {
  const themeValue = defineThemeStore((state) => state.colorPrimary)
  const initTheme = defineThemeStore((state) => state.init)
  useEffect(() => {
    initTheme()
  }, [])
  // return (
  //   <React.StrictMode>
  //     <ConfigProvider
  //       locale={zhCN}
  //       theme={{
  //         token: {
  //           colorPrimary: themeValue
  //         }
  //       }}
  //     >
  //       <Layout />
  //     </ConfigProvider>
  //   </React.StrictMode>
  // )
  return (
    <ConfigProvider
      locale={zhCN}
      theme={{
        token: {
          colorPrimary: themeValue
        }
      }}
    >
      <Layout />
    </ConfigProvider>
)
}
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(<App />)
